<template>
    <div class="content_base dataDetial">
       <h2 class="title">{{unit}}{{percentName}}</h2>
       <div class="iconback" @click="backchart">收缩&nbsp;&nbsp;&nbsp;<i class="iconfont icon-iconfonthaofang26-copy-copy-copy thisicon"></i></div>
       <el-table
       class="table"
         :data="tableData"
         stripe
         style="width: 100%">
         <el-table-column
           prop="unit"
           :label="unitName"
           >
         </el-table-column>
         <el-table-column
           prop="percent"
           :label="percentName">
         </el-table-column>
      </el-table>
    </div>
</template>
<script>
export default {
    data(){
        return{
            tableData:[],
            table:'',
            code:1,
            //标题
            percentName:'',
            unit:'',
            unitName:""
        }
    },
    methods:{
        backchart(){
            var BackchartPath = this.table=='main'?'chartOne':'chartTwo'
            this.$router.push({name:BackchartPath})
        }
    },
    mounted(){
        var _this = this
        this.table = this.$route.params.table
        this.code = this.$route.params.code
        this.percentName = this.table=='main'?'完成主体工程投资占批复投资百分比':'完成投资占批复总投资百分比'
        switch(this.code){
            case '1':
            this.unit='各市级'
            this.unitName = '市名称'
            break;
            case '2':
            this.unit='各县级'
             this.unitName = '县名称'
            break;
            case '3':
            this.unit='各圩堤'
             this.unitName = '圩堤名称'
            break;
        }
        //发送请求获得数据
        var thisDate = (new Date()).getTime()
        this.$axios.get(`/projectprocess/getData/${this.table}/${this.code}`,{params:{
          thisDate:thisDate}
        }).then(function(res){
             var codeMes = res.data.responseCode
         if(codeMes=='101'){
                _this.$router.push({name:'login'})
           }else{
            _this.tableData = res.data.responseData
            }
        }).catch(function(){
            _this.$message('获取详细数据失败，请重试或联系管理员');
        })
    }
    
}
</script>
<style>
.dataDetial .cell{
    text-align: center!important;
}
</style>

<style scoped>
.title{
    height: 100px;
    line-height: 100px;
}
.iconback{
    color:rgba(250, 183, 102);
    width:100px;
    margin-right:80px;
    height: 30px;
    float: right;
    line-height:30px;
    cursor: pointer;
}
.iconback, .thisicon{
    font-family: 'Avenir', Helvetica, Arial, sans-serif;
    font-size:14px;
}
.table{
    margin-left:25px;
}
</style>


